import 'package:flutter/material.dart';
import 'package:flutter_demo/chapter8-EventNotification/event-mechanism/HitTestBlocker.dart';
import 'package:flutter_demo/chapter8-EventNotification/gesture-conflict/CustomTapGestureRecongnizer.dart';

void main() {
  runApp(MaterialApp(
    home: Scaffold(
      appBar: AppBar(
        title: const Text("Event Widget Demo"),
      ),
      body: GestureDetectorWidget(),
    ),
  ));
}

class GestureDetectorWidget extends StatefulWidget {

  @override
  _GestureDetectorWidget createState() => _GestureDetectorWidget();
}

class _GestureDetectorWidget extends State<GestureDetectorWidget>{

  @override
  Widget build(BuildContext context) {
    return CustomGestureDetector(
      onTap: () => print(2),
      child: Container(
        width: 200,
        height: 200,
        color: Colors.red,
        alignment: Alignment.center,
        child: GestureDetector(
          onTapUp: (x) => print(1),
          child: Container(
            width: 50,
            height: 50,
            color: Colors.grey,
          ),
        ),
      ),
    );
  }
}
